package com.xbdun.service.bmp.service.system.impl;

import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xbdun.dao.bmp.mapper.SysOrgMenusMapper;
import com.xbdun.facade.bmp.request.system.SysOrgMenusRequest;
import com.xbdun.service.bmp.service.system.SysOrgMenusService;

@Service
@Transactional
public class SysOrgMenusServiceImpl implements SysOrgMenusService {
	@Autowired
	SysOrgMenusMapper sysOrgMenusMapper;
	
	public void impowerOrgMenus(SysOrgMenusRequest request) {
		
		if (!CollectionUtils.isEmpty(request.getAddCodes())) {
			sysOrgMenusMapper.addOrgMenus(request.getOrgCode(),request.getAddCodes());
		}
		
		if (!CollectionUtils.isEmpty(request.getCancelCodes())) {
			//删除特殊权限
			sysOrgMenusMapper.deletePowerUserSpec(request.getOrgCode(),request.getCancelCodes());
			//删除员工授权设置
			sysOrgMenusMapper.deletePowerUserMenu(request.getOrgCode(),request.getCancelCodes());
			//部门与角色
			sysOrgMenusMapper.deletePowerRoleDepart(request.getOrgCode(),request.getCancelCodes());
			//删除企业授权菜单
			sysOrgMenusMapper.deleteOrgMenus(request.getOrgCode(),request.getCancelCodes());
		}
	}
	
	
	
	
	
	
	
	
	
	
	
}